"""
RP2040 specific machine module extensions
"""

from typing import Optional, Callable

class PIO:
    """Programmable I/O"""

    IN: int
    OUT: int

    def __init__(self, id: int) -> None:
        """Create a PIO object"""
        ...

    def state_machine(self, id: int, program, **kwargs) -> 'StateMachine':
        """Create a state machine"""
        ...

class StateMachine:
    """PIO State Machine"""

    def active(self, value: Optional[bool] = None) -> bool:
        """Get or set active state"""
        ...

    def put(self, value: int) -> None:
        """Put value into TX FIFO"""
        ...

    def get(self) -> int:
        """Get value from RX FIFO"""
        ...

    def irq(self, handler: Optional[Callable] = None, trigger: int = 0) -> Callable:
        """Configure interrupt handler"""
        ...

def bootsel_button() -> int:
    """Read BOOTSEL button state"""
    ...
